package com.example.goodsass.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.goodsass.domain.ArticleCategories;
import com.example.goodsass.service.ArticleCategoriesService;
import com.example.goodsass.mapper.ArticleCategoriesMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleCategoriesServiceImpl extends ServiceImpl<ArticleCategoriesMapper, ArticleCategories> implements ArticleCategoriesService {
    @Resource
    ArticleCategoriesMapper articleCategoriesMapper;

    @Override
    public List<ArticleCategories> selByPage(Integer pageNo, Integer pageSize) {
        Integer pageno = (pageNo - 1) * pageSize;
        return articleCategoriesMapper.selByPage(pageno, pageSize);
    }

    @Override
    public ArticleCategories selByIdOrName(String id, String name) {
        return articleCategoriesMapper.selByNameOrName(id, name);
    }

    @Override
    public String updById(ArticleCategories articleCategories) {
        articleCategoriesMapper.updById(articleCategories);
        return "更新完成，分类ID：" + articleCategories.getCategoriesId();
    }

    @Override
    public String delById(String id) {
        articleCategoriesMapper.delById(id);
        return "删除成功，分类ID" + id;
    }
}
